let arrM = [0, 1, 4, 3, 1, 0, 0, 1, 2, 3, 1, 2, 1, 0]
let indexM = 0
let countM = 0
while(indexM < arrM.length){
    if(indexM == 0){
        if(arrM[0] > arrM[1]){
            console.log('arrM[indexM]0:', arrM[indexM])
            countM++
        }
    }else if(indexM > 0 && indexM < arrM.length - 1){
        if(arrM[indexM - 1] < arrM[indexM] && arrM[indexM] > arrM[indexM + 1]){
            console.log('arrM[indexM]:', arrM[indexM])
            countM++
        }
    }else if(indexM == arrM.length - 1){
        if(arrM[arrM.length - 2] < arrM[arrM.length - 1]){
            console.log('indexM:', indexM)
            console.log('arrM[indexM]e:', arrM[indexM])
            countM++
        }
    }
    indexM++
}

console.log('山峰数量:', countM)